import logging

from requests import Session

from config import HOST


class LoginApi:
    def __init__(self, session: Session):
        self.__session = session

    def login_api(self, keywords: str = "18500000007", password: str = "asd123"):
        data = {"keywords": keywords, "password": password}
        logging.info(F"登录接口 / 请求方法: post / 请求url: {HOST}/member/public/login / 请求数据{data}")
        return self.__session.post(HOST + "/member/public/login", data=data)

    def is_login_api(self):
        logging.info(F"查询是否登录接口 / 请求方法: post / 请求url: {HOST}/member/public/islogin")
        return self.__session.post(HOST + "/member/public/islogin")
    